public class demo02 {
    public static void main(String[] args) throws InterruptedException {
        Object locker=new Object();
        Thread t1=new Thread(()-> {
            try {
                System.out.println("wait之前！");
                synchronized (locker) {
                    locker.wait();
                }
                System.out.println("wait之后");
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        });
        t1.start();
        Thread.sleep(1000);

        Thread t2=new Thread(()->{
            synchronized (locker){
                System.out.println("notify开始");
                locker.notify();
                System.out.println("notify结束");
            }
        });
        t2.start();
    }
}
